/*
 * @Author: szx
 * @Date: 2022-05-19 14:37:41
 * @LastEditTime: 2022-05-19 14:41:00
 * @Description:
 * @FilePath: \leetcode\面试题\04\10\10.js
 */

/**
 * @param {TreeNode} t1
 * @param {TreeNode} t2
 * @return {boolean}
 */
var checkSubTree = function (t1, t2) {
    if (!t1 && !t2) return true;
    if (!t1 || !t2) return false;
    if (t1.val == t2.val) {
        return checkSubTree(t1.left, t2.left) && checkSubTree(t1.right, t2.right);
    } else {
        return checkSubTree(t1.left, t2) || checkSubTree(t1.right, t2);
    }
};
